<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;

class Evalua extends Controller
{

    public function index()
    {
        $evalua = Db::name("evalua e")
        ->join("user u","e.userId=u.userId")
        ->join("ftypes f","e.etypeId=f.fId")
        ->where("estatus",1)
        ->field("eId,eContent,e.userId,name,fName,eTitle,ePic,etime")
        ->select();
        // dump($evalua);
        $this->assign("evalua",$evalua);
        return $this->fetch();
    }

    public function dellot($key){
        $data = [
            "pstatus"=>1
        ];
        $rs = Db::name("evalua")
        ->whereLike("eContent","%".$key."%")
        ->update($data);
        echo Db::name("evalua")->getLastSql();
    }

    public function del($id)
    {
        $data = [
            "eId"=>$id,
            "estatus"=>0
        ];
        $rs = Db::name("evalua")->update($data);
        if($rs){
            $this->redirect('index');
        }else{
            $this->redirect('index?err=1');
        }
    }

    // public function forbidden(){
    //     $evalua = Db::name("evalua e")
    //     ->join("goods g","e.goodId=g.gId")->join("user u","e.uId=u.userId")
    //     ->where("cstatus",0)
    //     ->field("cId,cContent,e.goodId,g.gId,gTitle,name")
    //     ->select();
    //     $this->assign("evalua",$evalua);
    //     return $this->fetch();
    // }
    // public function recoverlot($key){
    //     $data = [
    //         "cstatus"=>0
    //     ];
    //     $rs = Db::name("evalua")
    //     ->whereLike("cContent","%".$key."%")
    //     ->update($data);
    //     echo Db::name("evalua")->getLastSql();
    // }

}
